<html>
<head>
  <style>
    #content {
      width: 7500px;
      height: 7500px;
      background-color: blue;
    }
  </style>
  <script src="../../resources/js-test.js"></script>
  <script>
    onload = function() {
      description('Test that calling scroll methods on the body element scrolls the viewport in quirks mode');

      debug('Test that "scroll" on the document element does not scroll');
      document.documentElement.scroll(100, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "0");
      shouldBe("document.body.scrollLeft", "0");

      debug('');
      debug('Test that "scrollTo" on the document element does not scroll');
      document.documentElement.scrollTo(100, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "0");
      shouldBe("document.body.scrollLeft", "0");

      debug('');
      debug('Test that "scrollBy" on the document element does not scroll');
      document.documentElement.scrollBy(100, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "0");
      shouldBe("document.body.scrollLeft", "0");

      debug('');
      debug('Test that "scroll" on the body element scrolls');
      document.body.scroll(50, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "100");
      shouldBe("document.body.scrollLeft", "50");

      debug('');
      debug('Test that "scrollTo" on the body element scrolls');
      document.body.scrollTo(450, 200);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "200");
      shouldBe("document.body.scrollLeft", "450");

      debug('');
      debug('Test that "scrollBy" on the body element scrolls');
      document.body.scrollBy(300, 100);
      shouldBe("document.documentElement.scrollTop", "0");
      shouldBe("document.documentElement.scrollLeft", "0");
      shouldBe("document.body.scrollTop", "300");
      shouldBe("document.body.scrollLeft", "750");
    }
  </script>
</head>

<body>
  <div id="content"></div>
</body>
</html>
